<template>
  <div>
    <router-view></router-view>
  </div>
</template>
<script>
import axios from 'axios'
export default {
    data() {
        return {
            
        }
    },
    methods: {
        init(){
            this.$store.autoLogin((data)=>{
                this.admin()
            })
        },
        admin(){
            if(this.$store.getUser('userType') === 9){
                //平台管理员
                this.$router.push({
                    name: 'mall-home-index'
                })
            } else {
                //商户
                this.$router.push({
                    name: 'mch-home-index'
                })
            }
        },
        copyright() {
            let hostname = window.location.hostname
            const request = axios.create()
            request.get("http://mall.rongcuntech.com/hostname.json?202511041106").then((response) => {
                response.data.forEach(element => {
                    if(element.hostname === hostname) {
                        this.$store.setSystem('platform', element.platform)
                        this.$store.setSystem('copyright', element.copyright)
                    }
                })
            })
            
            if(!this.$store.getSystem('platform')) {
                this.$store.setSystem('platform', '联村农服')
                this.$store.setSystem('copyright', '贵州融村数字科技有限责任公司')
            }
        }
    },
    created(){
        this.init()
        this.copyright()
    }
}
</script>
<style scoped>
@import './styles/common.css';
.layout{
    position: absolute; top: 0; left: 0; bottom: 0; width: 100%; height: auto; overflow: hidden;
}
</style>